package cn.com.cpic.insurance.rulecheck.core.condition;

import cn.com.cpic.insurance.rulecheck.core.AbstractTokenable;
import cn.com.cpic.insurance.rulecheck.core.Context;
import cn.com.cpic.insurance.rulecheck.core.exception.OperateException;

/**
 * 
 * 
 * @author 代波
 * @since 2011-8-13
 */
public abstract class AbstractConditionGroup extends AbstractTokenable<String> implements ConditionGroup {
	private static final long serialVersionUID = 5374868715705216259L;

	protected AbstractConditionGroup(String token) {
		super(token);
	}

	public final Boolean operate(Context context) throws OperateException {
		boolean result = true;
		for (Condition c : getConditionSet()) {
			if (!(result = c.operate(context)))
				break;
		}
		return result;
	}
}
